'use strict';
module.exports = app => {
  // 地址表
  const {INTEGER, STRING} = app.Sequelize;
  const Address = app.model.define('s_address', {
    id: {type: INTEGER, primaryKey: true, autoIncrement: true},
    user_id: {
      type: INTEGER,
      comment: '用户id',
    },
    name: STRING,
    phone: STRING,
    area: {
      type: STRING,
      comment: '地区id集合',
    },
    area_name: {
      type: STRING,
      comment: '省市区',
    },
    area_code: {
      type: STRING,
      allowNull: true,
    },
    desc: {
      type: STRING,
      comment: '详细地址',
    },
    post_code: {
      type: STRING,
      comment: '邮政编码',
    },
    default_set: {
      type: STRING,
      comment: '默认地址 1',
      defaultValue: 0,
    },
    status: {
      type: STRING,
      comment: '1正常 2删除',
      defaultValue: 1,
    },
  });

  return Address;
};
